using System.IO.Ports;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace SerialTool.Models;

// 应用程序持久化配置类
public class AppSettings
{
    // 串口设置
    public int BaudRate { get; set; } = 9600;
    public int DataBits { get; set; } = 8;
    public Parity SelectedParity { get; set; } = Parity.None;
    public StopBits SelectedStopBits { get; set; } = StopBits.One;
    
    // 编码设置
    public string SelectedSendEncoding { get; set; } = "ASCII";
    public bool HexDisplay { get; set; } = false;
    
    // 定时发送设置
    public string SendInterval { get; set; } = "1000";
    
    // 过滤设置
    public bool ShowSent { get; set; } = true;
    public bool ShowReceived { get; set; } = true;
    
    // 自动滚动设置
    public bool AutoScrollEnabled { get; set; } = true;
    
    // 窗口状态（如果需要记住窗口大小/位置）
    // 注意：在跨平台环境中，窗口状态持久化可能需要平台特定实现
    public int WindowWidth { get; set; } = 800;  // 默认窗口宽度
    public int WindowHeight { get; set; } = 600; // 默认窗口高度
    public bool IsMaximized { get; set; } = false;
    
    // 协议配置
    [JsonIgnore] // 运行时使用，不直接序列化
    public List<ProtocolConfig> Protocols { get; set; } = new List<ProtocolConfig>();
    
    public string ActiveProtocolType { get; set; } = "None";
    
    // 协议特定设置 - 序列化为JSON字符串
    public string ModbusSettings { get; set; } = string.Empty;
    public string CustomProtocolSettings { get; set; } = string.Empty;
} 